package com.future.mayi.model;

import com.future.mayi.app.App;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class GoodsBatchModel implements Serializable {
    private List<SpecModel> list;
    private List<SpecModel> goods;
    private String address;
    private String memo;
    private double money;
    private double postage = -1;
    private String goods_id;
    private String order_info;
    private GoodsMultiPostfeeModel goodsMultiPostfeeModel;

    public List<SpecModel> getList() {
        return list;
    }

    public void setList(List<SpecModel> list) {
        this.list = list;
    }

    public List<SpecModel> getSelectList() {
        return goods;
    }

    public void setSelectList(List<SpecModel> goods) {
        this.goods = goods;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public double getMoney() {
        return money;
    }

    public void setMoney(double money) {
        this.money = money;
    }

    public List<SpecModel> getGoods() {
        return goods;
    }

    public void setGoods(List<SpecModel> goods) {
        this.goods = goods;
    }


    public String getMemo() {
        return memo;
    }

    public void setMemo(String memo) {
        this.memo = memo;
    }

    public double getPostage() {
        return postage;
    }

    public void setPostage(double postage) {
        this.postage = postage;
    }

    public String getGoods_id() {
        return goods_id;
    }

    public void setGoods_id(String goods_id) {
        this.goods_id = goods_id;
    }



    public GoodsMultiPostfeeModel getGoodsMultiPostfeeModel() {
        goodsMultiPostfeeModel = new GoodsMultiPostfeeModel();
        List<GoodsItemMultiPostfeeModel> goods = new ArrayList<>();
        for (SpecModel specModel : getSelectList()) {
            GoodsItemMultiPostfeeModel itemModel = new GoodsItemMultiPostfeeModel(specModel.getGoods_spec_id(), specModel.getNum());
            goods.add(itemModel);
        }
        goodsMultiPostfeeModel.setAddress(getAddress());
        goodsMultiPostfeeModel.setGoods(goods);
        goodsMultiPostfeeModel.setMemo(getMemo());
        return goodsMultiPostfeeModel;
    }

    public void setGoodsMultiPostfeeModel(GoodsMultiPostfeeModel goodsMultiPostfeeModel) {
        this.goodsMultiPostfeeModel = goodsMultiPostfeeModel;
    }

    public String getOrder_info() {
        List<GoodsMultiPostfeeModel> list = new ArrayList<>(1);
        list.add(getGoodsMultiPostfeeModel());
        order_info = App.getGson().toJson(list);
        return order_info;
    }

    public void setOrder_info(String order_info) {
        this.order_info = order_info;
    }
}
